<%@ Page Title="Component Details" Language="C#" MasterPageFile="~/MasterPage.master"
	AutoEventWireup="true" CodeFile="View_Comp.aspx.cs" Inherits="admin_View_Comp" %>

<asp:Content ID="Head" ContentPlaceHolderID="head" runat="Server">
	<link href="../styles/admin.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
	<div id="top_menu">
		<div id="help_button">
			help
		</div>
		<div id="logout">
			<asp:LoginStatus ID="LoginStatus1" runat="server" LogoutPageUrl="../Default.aspx"
				OnLoggingOut="LoginStatus1_LoggingOut" />
		</div>
	</div>
	<div id="page_title">
		ADMINISTRATION
	</div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">

	<div id="left_content">
		<div class="menu">
			<ul>
				<li><a href="Home.aspx">Home</a></li>
				<li><a href="Mng_Client.aspx">Manage Clients</a></li>
				<li><a href="Mng_Site.aspx">Manage Sites</a></li>
				<li><a href="Mng_Machine.aspx">Manage Machines</a></li>
				<li><a href="#" class="current">View Component Details</a></li>
				<li><a href="Mng_Report.aspx">Manage Reports</a></li>
				<li><a href="Mng_WO.aspx">Manage Work Order</a></li>
				<li><a href="Mng_FaultsRecom.aspx">Manage Faults Recommendation</a></li>
			</ul>
		</div>
	</div>
	<!-- end of left content -->
	<div id="right_content">
		<div class="content_area">
			<script type="text/javascript" language="javascript">
				function UpdateClick() {
			
					

				}
	
	
	</script>
			<h2>
				Components Details
			</h2>
			<div class="form_box1">
				<asp:FormView ID="FormViewComponent" runat="server" DataKeyNames="component_id" DataSourceID="ComponentsObjectDataSource" OnItemUpdating="Item_OnUpdating">
					<EditItemTemplate>
						<table>
							<tr>
								<td class="label1">
									Component ID:
								</td>
								<td>
									<asp:Label ID="component_idLabel1" runat="server" Text='<%# Eval("component_id") %>'
										CssClass="fields1" />
								</td>
							</tr>
							<tr>
								<td class="label1">
									Component Name:
								</td>
								<td>
									<asp:TextBox ID="componentNameTextBox" runat="server" Text='<%# Bind("componentName") %>'
										CssClass="fields1" />
								</td>
							</tr>
							<tr>
								<td class="label1">
									Machine Name:
								</td>
								<td>
									<asp:DropDownList ID="machineNameDropDownList" runat="server" DataSourceID="MachinesObjectDataSource"
										DataTextField="machineName" DataValueField="machine_id" SelectedValue='<%# Bind("machine_id") %>'
										CssClass="dropDownList">
									</asp:DropDownList>
									<asp:ObjectDataSource ID="MachinesObjectDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
										SelectMethod="GetData" TypeName="DataAccess.i2iPortalTableAdapters.MachinesTableAdapter">
									</asp:ObjectDataSource>
								</td>
							</tr>
							<tr>
								<td class="label1">
									Test Interval:
								</td>
								<td>
									<asp:DropDownList ID="dropdownlist_TimeInterval" runat="server"	DataSourceID="TestInterValDataSource" DataTextField="Name" DataValueField="Interval_Id"
										CssClass="dropDownList" OnPreRender="DropList_PreRender" AppendDataBoundItems="true" >
										<asp:Listitem Text = "Please Select" Value=""></asp:Listitem>
									</asp:DropDownList>
						<asp:ObjectDataSource ID="TestInterValDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
										SelectMethod="GetTestInterval" TypeName="DataAccess.i2iPortalTableAdapters.TestInterValTableAdapter">
						<SelectParameters>
						<asp:SessionParameter Name="CompanyID" DbType="Int32" SessionField="CompanyID"/>
					</SelectParameters>
									</asp:ObjectDataSource>
								</td>
							</tr>
							<tr>
								<tr>
									<td>				
									</td>
									<td class="Li_buttonC">
										<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" OnClientClick="UpdateClick()" OnClick="UpdateClicked"
											Text="Update" />
									</td>
								</tr>
								<tr>
									<td>
									</td>
									<td class="Li_buttonC">
										<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel">                            
                            Cancel
										</asp:LinkButton>
									</td>
								</tr>
						</table>
					</EditItemTemplate>
					<ItemTemplate>
						<table>
							<tr>
								<td class="label1">
									Component ID:
								</td>
								<td>
									<asp:Label ID="component_idLabel" runat="server" Text='<%# Eval("component_id") %>'
										CssClass="fields" />
								</td>
							</tr>
							<tr>
								<td class="label1">
									Component Name:
								</td>
								<td>
									<asp:Label ID="componentNameLabel" runat="server" Text='<%# Bind("componentName") %>'
										CssClass="fields" />
								</td>
							</tr>
							<tr>
								<td class="label1">
									Machine ID:
								</td>
								<td>
									<asp:Label ID="machine_idLabel" runat="server" Text='<%# Bind("machine_id") %>' CssClass="fields" />
								</td>
							</tr>
							<tr>
								<td class="label1">
									Test Interval:
								</td>
								<td>
									<asp:Label ID="lb_TestInterval" runat="server" Text='<%# Bind("InterValName") %>'
										CssClass="fields" />
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td class="Li_buttonC">
									<asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit"
										Text="Edit" />
								</td>
							</tr>
						</table>
					</ItemTemplate>
				</asp:FormView>
				<asp:ObjectDataSource ID="ComponentsObjectDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
					SelectMethod="GetTestInterVal" TypeName="DataAccess.i2iPortalTableAdapters.ComponentsTableAdapter"
					UpdateMethod="Update" DeleteMethod="Delete" InsertMethod="Insert" >
					<DeleteParameters>
						<asp:Parameter Name="Original_component_id" Type="Int32" />
					</DeleteParameters>
					<UpdateParameters>
						<asp:Parameter Name="machine_id" Type="Int32" />
						<asp:Parameter Name="componentName" Type="String" />
						<asp:Parameter Name="category_id" Type="Int32" />
						<asp:Parameter Name="Original_component_id" Type="Int32" />
						<asp:Parameter Name="Interval_Id" Type="Int32" />
					</UpdateParameters>
					<SelectParameters>
						<asp:QueryStringParameter Name="component_id" QueryStringField="component_id" Type="Int32" />
					</SelectParameters>
					<InsertParameters>
						<asp:Parameter Name="machine_id" Type="Int32" />
						<asp:Parameter Name="componentName" Type="String" />
						<asp:Parameter Name="category_id" Type="Int32" />
						<asp:Parameter Name="Interval_Id" Type="Int32" />
					</InsertParameters>
				</asp:ObjectDataSource>
			</div>
		</div>
		<div class="content_area2">
			<h2>
				Component Reports
			</h2>
			<div class="form_box">
				<asp:GridView ID="GridViewReport" runat="server" AllowPaging="True" AutoGenerateColumns="False"
					DataKeyNames="component_id,dateRecorded" DataSourceID="ComponentStatusObjectDataSource"
					OnSelectedIndexChanged="GridViewReport_SelectedIndexChanged" AllowSorting="True">
					<Columns>
						<asp:BoundField DataField="dateRecorded" DataFormatString="{0:d}" HeaderText="Date Recorded"
							ReadOnly="True" SortExpression="dateRecorded">
							<ItemStyle CssClass="column" />
						</asp:BoundField>
						<asp:BoundField DataField="dateEntered" DataFormatString="{0:d}" HeaderText="Date Entered"
							SortExpression="dateEntered"></asp:BoundField>
						<asp:BoundField DataField="statusName" HeaderText="Status" SortExpression="statusName">
							<ItemStyle CssClass="column" />
						</asp:BoundField>
						<asp:CommandField SelectText="Details..." ShowSelectButton="True">
							<ItemStyle CssClass="column" />
						</asp:CommandField>
					</Columns>
					<PagerStyle CssClass="pager" />
					<HeaderStyle CssClass="header" />
				</asp:GridView>
				<asp:ObjectDataSource ID="ComponentStatusObjectDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
					SelectMethod="GetDataByComponentID" TypeName="DataAccess.i2iPortalTableAdapters.ComponentStatusOnComponentsTableAdapter">
					<SelectParameters>
						<asp:QueryStringParameter Name="component_id" QueryStringField="component_id" Type="Int32" />
					</SelectParameters>
				</asp:ObjectDataSource>
				<br />
				<asp:Button ID="CreateReportButton" runat="server" Text="Add New Report" OnClick="CreateReportButton_Click"
					CssClass="buttons" />
			</div>
		</div>
		<asp:LinkButton ID="BackButton" runat="server" PostBackUrl="Mng_Comp.aspx" CssClass="backbtn">Back</asp:LinkButton>
		<!-- end of right content -->
	</div>
</asp:Content>
